package com.osexp.ui;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
public class Frame extends JFrame{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static final int FRAME_WIDTH;
	private static final int FRAME_LENGTH;
	private static final int WINDOW_UP;
	static{
		FRAME_WIDTH=800;
		FRAME_LENGTH=600;
		WINDOW_UP=30;
	}
	public Frame(MainPanel Panel){
		this.setTitle("进程访问内存过程模拟");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setSize(FRAME_WIDTH, FRAME_LENGTH);
		this.setResizable(false);
		//set the location in the 
		Toolkit toolkit = Toolkit.getDefaultToolkit();
		Dimension screenSize=toolkit.getScreenSize();
		int x=(screenSize.width-this.getWidth())>>1;
		int y=(screenSize.height-this.getHeight())>>1-WINDOW_UP;
		this.setLocation(x,y);
		//set default panel
		this.add(Panel);
		Panel.requestFocus();
		//default set the window visible
		this.setVisible(true);	
	}
	public static void main(String[] args){
		MainPanel panel = new MainPanel();
		@SuppressWarnings("unused")
		Frame frame=new Frame(panel);
	}		
}
